<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of Tree
 *
 * @author John
 */
namespace Org\Util;
class Tree {
    static public $treeList = array();
    
    public function create($data,$pid = 0){
        foreach($data as $key => $value){
            if($value['pid'] == $pid){
                self::$treeList[] = $value;
                unset($data[$key]);
                self::create($data,$value['id']);
            }
        }
        return self::$treeList;
    }
}
